#include <stdio.h>

int main() {
    int y, h;
    
    scanf("%d %d", &y, &h);
    
    double c = (y >= 5) ? 50.0 : 30.0;
    
    double d = 0.0;
    
    if (h <= 40) {
        d = c * h;
    } else {
        d = c * 40 + 1.5 * c * (h - 40); 
    }
    printf("%.2f\n", d);
    
    return 0;
}
